/*
Purpose: Calculate state-level normed progress numbers used in paper
*/


use "data/clean/math8_normed", clear

keep scale_score_norm pctile_10_norm pctile_90_norm state_abbrev year
keep if inlist(state_abbrev,"NC","AL","IA","MT")
keep if inlist(year,1990,1992,2015,2019)
reshape wide scale_score_norm pctile_10_norm pctile_90_norm, i(state_abbrev) j(year)

gen pctile_10_diff = pctile_10_norm2019 - pctile_10_norm1990
gen pctile_90_diff = pctile_90_norm2019 - pctile_90_norm1990
gen avg_diff = scale_score_norm2019 - scale_score_norm1990

keep state_abbrev *diff
export delimited using "results/state_normed_progress_90_19.csv", replace


use "data/clean/math8_normed", clear

keep scale_score_norm state_abbrev year
keep if inlist(year,1990,1992,2019)
reshape wide scale_score_norm, i(state_abbrev) j(year)
gen avg_diff = scale_score_norm2019 - scale_score_norm1992
gen avg_diff_9092 = scale_score_norm1992 - scale_score_norm1990

keep state_abbrev *diff*

export delimited using "results/state_normed_progress_92_19.csv", replace

